package com.chen.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.chen.annotation.OptLog;
import com.chen.common.OptTypeConst;
import com.chen.common.Result;
import com.chen.entity.ExamPaper;
import com.chen.entity.Sign;
import com.chen.service.impl.ExamPaperServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author personcoder007
 * @since 2022-08-17
 */
@RestController
@RequestMapping("/examPaper")
@Api(value = "ExamPaperController", tags = "考试试卷")
public class ExamPaperController {


    @Autowired
    private ExamPaperServiceImpl examPaperService;
    @PostMapping("/save")
    @ApiOperation(value = "新增或者更新")
    @OptLog(optType = OptTypeConst.SAVE_OR_UPDATE)
    public Result add(@RequestBody ExamPaper paper) {
        examPaperService.addPapaer(paper);
        return Result.success();
    }


    @GetMapping("/exam/{examId}")
    @ApiOperation("查询试卷")
    public Result findByExamId(@PathVariable("examId") Integer examId) {
        return  Result.success(examPaperService.getOne(new QueryWrapper<ExamPaper>().eq("exam_id",examId)));
    }

}

